package com.zxx.pattern.mediatorPattern.mediator3;

/**
 * @author zxx on 2021/5/11
 */
public class MediatorTest3 {
    public static void main(String[] args) {
        //构造主板
        MediatorMainBoard mainBoard = new MediatorMainBoard();

        //构造各个零部件
        ColleagueCDDevice cdDevice = new ColleagueCDDevice(mainBoard);
        ColleagueCPU cpu = new ColleagueCPU(mainBoard);
        ColleagueSoundCard soundCard = new ColleagueSoundCard(mainBoard);
        ColleagueGraphics graphics = new ColleagueGraphics(mainBoard);

        //部件安装到主板上
        mainBoard.setCdDevice(cdDevice);
        mainBoard.setCpu(cpu);
        mainBoard.setGraphics(graphics);
        mainBoard.setSoundCard(soundCard);

        //安装完后 放片
        cdDevice.load();
    }
}
